import { createRouter, createWebHistory } from "vue-router";

const router = createRouter({
  history: createWebHistory(),
  routes: [
    {
      path: "/",
      component: () => import("../pages/Home.vue"),
    },
    {
      path: "/webpack-vue/:pathMatch(.*)*",
      // 将qiankun的渲染容器container，单独拆分一个组件页面，解决路由警告的问题
      component: () => import("../pages/container.vue"),
    }
  ],
});

// vue2的路由才会出现报错，需要如下处理
// router.beforeEach((to, from, next) => {
//   if (_.isEmpty(history.state.current)) {
//     _.assign(history.state, { current: from.fullPath });
//   }
//   next();
// });

export default router;
